{include file="public/layout" /}

<body class="bodystyle" style="overflow-y: scroll; cursor: default; -moz-user-select: inherit;">
<style type="text/css">

.system_table{ border:1px solid #dcdcdc; width:100%;}
.system_table td{ height:40px; line-height:40px; font-size:12px; color:#454545; border-bottom:1px solid #dcdcdc; border-right:1px solid #dcdcdc; width:35%;padding-left:3%;}
.system_table td.gray_bg{ background:#f7f7f7; width:15%;}

</style>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    {include file="member/bar" /}
    <div class="flexigrid">
        <div class="mDiv">
            <div class="ftitle">
                <h3>订单详情</h3>
            </div>
            <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>
            <div class="sDiv">
                <div class="sDiv2 addartbtn fl" style="margin-right: 6px;">
                    <input type="button" class="btn current" value="返回列表" onclick="window.location.href='{:url("Shop/index")}';">
                </div>
            </div>
        </div>
        <form class="form-horizontal" id="postForm" action="{:url('Shop/order_mark_status')}" method="post">
            <input type="hidden" name="order_id" value="{$OrderData.order_id}">
            <input type="hidden" name="order_code" value="{$OrderData.order_code}">
            <input type="hidden" name="users_id" value="{$OrderData.users_id}">
            <input type="hidden" name="consignee" value="{$OrderData.consignee}">
            <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                            <tr>
                                <th class="sign w10" axis="col0">
                                    <div class="tc"></div>
                                </th>
                                <th abbr="article_title" axis="col3" class="w10">
                                    <div class="tc">订单信息</div>
                                </th>
                                <th abbr="ac_id" axis="col4">
                                    <div class=""></div>
                                </th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>

            <div class="ncap-form-default">
                <table cellpadding="0" cellspacing="0" class="system_table">
                    <tbody>
                        <tr>
                            <td class="gray_bg">订单ID：</td>
                            <td>{$OrderData.order_id}</td>
                            <td class="gray_bg">订单编号：</td>
                            <td>{$OrderData.order_code}</td>
                        </tr>
                        <tr>
                            <td class="gray_bg">用户名：</td>
                            <td>{$UsersData.username}</td>
                            <td class="gray_bg">邮箱地址：</td>
                            <td>{$UsersData.email}</td>
                        </tr>
                        <tr>
                            <td class="gray_bg">手机号码：</td>
                            <td>{$UsersData.mobile}</td>
                            <td class="gray_bg">应付金额：</td>
                            <td>￥{$OrderData.order_amount}</td>
                        </tr>
                        <tr>
                            <td class="gray_bg">支付方式：</td>
                            <td>
                                {eq name="$OrderData.payment_method" value="1"}
                                    货到付款
                                {else/}
                                    在线支付
                                {/eq}
                            </td>
                            <td class="gray_bg">订单状态：</td>
                            <td>
                                {$admin_order_status_arr[$OrderData.order_status]|default=''}
                                {eq name="$OrderData.order_status" value="2"}
                                    &nbsp;<a href="javascript:void(0);" data-url="{:url('Shop/order_send',array('order_id'=>$OrderData['order_id']))}" onclick="sendOrderDetails(this);" class="ncap-btn ncap-btn-green" >
                                        发货详情
                                    </a>
                                    <script type="text/javascript">
                                        // 发货、标记未付款
                                        function sendOrderDetails(obj){
                                            var url = $(obj).attr('data-url');
                                            //iframe窗
                                            var iframes = layer.open({
                                                type: 2,
                                                title: '订单发货详情',
                                                fixed: true, //不固定
                                                shadeClose: false,
                                                shade: 0.3,
                                                area: ['100%', '100%'],
                                                content: url
                                            });
                                            layer.full(iframes);
                                        }
                                    </script>
                                    {eq name="$OrderData.prom_type" value="0"}
                                        &nbsp;<a href="javascript:void(0);" data-url="{$MobileExpressUrl}" onclick="LogisticsInquiry(this);" class="ncap-btn ncap-btn-green" >
                                            物流查询
                                        </a>
                                        <script type="text/javascript">
                                            // 发货、标记未付款
                                            function LogisticsInquiry(obj){
                                                var url = $(obj).attr('data-url');
                                                //iframe窗
                                                var iframes = layer.open({
                                                    type: 2,
                                                    title: '物流查询',
                                                    shadeClose: false,
                                                    maxmin: false, //开启最大化最小化按钮
                                                    area: ['60%', '80%'],
                                                    content: url
                                                });
                                            }
                                        </script>
                                    {/eq}
                                {/eq}
                            </td>
                        </tr>
                        <tr>
                            <td class="gray_bg">下单时间：</td>
                            <td>{$OrderData.add_time|MyDate='Y-m-d H:i:s',###}</td>
                            <td class="gray_bg">付款时间：</td>
                            <td>{$OrderData.pay_time|MyDate='Y-m-d H:i:s',###}</td>
                        </tr>
                        <tr>
                            <td class="gray_bg">付款方式：</td>
                            <td>
                                {eq name="$OrderData.payment_method" value="1"}
                                    快递代收
                                {else/}
                                    {gt name='$OrderData.order_amount' value='0'}
                                        {$pay_method_arr[$OrderData.pay_name]|default='未付款'}
                                    {else /}
                                        免支付
                                    {/gt}
                                {/eq}
                            </td>
                            <td class="gray_bg">订单类型：</td>
                            <td>{$OrderData.prom_type_name}</td>
                        </tr>
                        {empty name="$OrderData.prom_type"}
                            <tr>
                                <td class="gray_bg">物流公司：</td>
                                <td>{$OrderData.express_name}</td>
                                <td class="gray_bg">配送单号：</td>
                                <td>{$OrderData.express_order}</td>
                            </tr>
                        {/empty}
                    </tbody>
                </table>
            </div>

            <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                            <tr>
                                <th class="sign w10" axis="col0">
                                    <div class="tc"></div>
                                </th>
                                <th abbr="article_title" axis="col3" class="w10">
                                    <div class="tc">收货信息</div>
                                </th>
                                <th abbr="ac_id" axis="col4">
                                    <div class=""></div>
                                </th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="ncap-form-default">
                {empty name="$OrderData.prom_type"}
                <dl class="row">
                    <dt class="tit">
                        <label>收货人</label>
                    </dt>
                    <dd class="opt">          
                        {$OrderData.consignee}
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit">
                        <label>联系方式</label>
                    </dt>
                    <dd class="opt">          
                        {$OrderData.mobile}
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit">
                        <label>收货地址</label>
                    </dt>
                    <dd class="opt">          
                        {$OrderData.country} {$OrderData.province} {$OrderData.city} {$OrderData.district} {$OrderData.address}
                    </dd>
                </dl>
               
                {/empty}
                <dl class="row">
                    <dt class="tit">
                        <label>订单留言</label>
                    </dt>
                    <dd class="opt">          
                        {$OrderData.user_note}
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit">
                        <label>管理员备注</label>
                    </dt>
                    <dd class="opt">          
                        <textarea rows="5" cols="60" id="admin_note" name="admin_note" style="height:60px;">{$OrderData.admin_note}</textarea>
                        <span class="err"></span>
                        <p class="notic"></p>
                    </dd>
                </dl>
                <div class="bot" style="padding-bottom:0px;">
                    <input type="hidden" name="gourl" value="{$gourl|default=''}">
                    <a href="JavaScript:void(0);" onclick="UpNote('{$OrderData.order_id}');" class="ncap-btn-big ncap-btn-green" id="submitBtn">保存</a>
                </div>
            </div>

            <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                        <tr>
                            <th class="sign w10" axis="col0">
                                <div class="tc"></div>
                            </th>
                            <th abbr="article_title" axis="col3" class="w10">
                                <div class="tc">商品信息</div>
                            </th>
                            <th abbr="ac_id" axis="col4">
                                <div class=""></div>
                            </th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>

            <div class="hDiv" style="margin-top: 5px;">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                            <tr>
                                <th class="sign w60" axis="col0">
                                    <div class="tc">商品ID</div>
                                </th>
                                <th abbr="article_title" axis="col3" class="">
                                    <div style="text-align: left; padding-left: 10px;" class="">商品名称</div>
                                </th>
                                <th abbr="article_time" axis="col6" class="w150">
                                    <div class="tl">规格属性</div>
                                </th>
                                <th abbr="article_time" axis="col6" class="w80">
                                    <div class="tc">数量</div>
                                </th>
                                <th abbr="article_time" axis="col6" class="w100">
                                    <div class="tc">会员价格</div>
                                </th>
                                <th abbr="article_title" axis="col3" class="w100">
                                    <div class="tc">单品小计</div>
                                </th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="bDiv" style="height: auto;">
                <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
                    <table style="width: 100%;">
                        <tbody>
                        {empty name="DetailsData"}
                            <tr>
                                <td class="no-data" align="center" axis="col0" colspan="50">
                                    <i class="fa fa-exclamation-circle"></i>没有符合条件的记录
                                </td>
                            </tr>
                        {else/}
                            {foreach name="DetailsData" item="vo" key="k" }
                            <tr>
                                <td class="sort">
                                    <div class="tc w60">
                                        {$vo.product_id}
                                    </div>
                                </td>
                                <td class="" style="width: 100%;">
                                    <div class="tl" style="padding-left: 10px;">
                                        <a href="{$vo.arcurl}" target="_blank">
                                            <img src="{$vo.litpic}" style="width: 60px;height: 60px;"> {$vo.product_name}
                                        </a>
                                    </div>
                                </td>
                                <td class="sort">
                                    <div class="tl w150">
                                        {$vo.data}
                                    </div>
                                </td>
                                <td class="sort">
                                    <div class="tc w80">
                                        {$vo.num}
                                    </div>
                                </td>
                                <td class="sort">
                                    <div class="tc w100">
                                        ￥{$vo.product_price}
                                    </div>
                                </td>
                                <td class="sort">
                                    <div class="tc w100">
                                        ￥{$vo.subtotal}
                                    </div>
                                </td>
                            </tr>
                            {/foreach}
                        {/empty}
                        </tbody>
                    </table>
                </div>
                <div class="iDiv" style="display: none;"></div>
            </div>

            <!-- <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                        <tr>
                            <th class="sign w10" axis="col0">
                                <div class="tc"></div>
                            </th>
                            <th abbr="article_title" axis="col3" class="w10">
                                <div class="tc">操作信息</div>
                            </th>
                            <th abbr="ac_id" axis="col4">
                                <div class=""></div>
                            </th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="ncap-form-default">
                <input type="hidden" name="status_name" id="status_name">
                <dl class="row">
                    <dt class="tit">
                        <label for="uname">可执行操作</label>
                    </dt>
                    <dd class="opt">
                        {eq name="$OrderData['order_status']" value='0'}
                            <a href="JavaScript:void(0);" onclick="OrderMark('yfk');" class="ncap-btn-big ncap-btn-green" id="submitBtn">
                                标记已付款
                            </a>
                        {/eq}
                        {eq name="$OrderData['order_status']" value='2'}
                            <a href="JavaScript:void(0);" onclick="OrderMark('ysh');" class="ncap-btn-big ncap-btn-green" id="submitBtn">
                                标记已收货
                            </a>
                        {/eq}
                        {neq name="$OrderData['order_status']" value='-1'}
                            <a href="JavaScript:void(0);" onclick="OrderMark('wx');" class="ncap-btn-big ncap-btn-green" id="submitBtn">
                                标记为无效
                            </a>
                        {/neq}
                    </dd>
                </dl>
            </div> -->

            <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                        <tr>
                            <th class="sign w10" axis="col0">
                                <div class="tc"></div>
                            </th>
                            <th abbr="article_title" axis="col3" class="w10">
                                <div class="tc">操作记录</div>
                            </th>
                            <th abbr="ac_id" axis="col4">
                                <div class=""></div>
                            </th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="hDiv" style="margin-top: 5px;">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                        <tr>
                            <th class="sign w10" axis="col0">
                                <div class="tl"></div>
                            </th>
                            <th class="sign w130" axis="col0">
                                <div class="tl">操作者</div>
                            </th>
                            <th abbr="article_title" axis="col3" class="w180">
                                <div class="tc">操作时间</div>
                            </th>
                            <th abbr="article_time" axis="col6" class="w100">
                                <div class="tc">支付状态</div>
                            </th>
                            <th abbr="article_time" axis="col6" class="w100">
                                <div class="tc">发货状态</div>
                            </th>
                            <th abbr="article_time" axis="col6" class="w100">
                                <div class="tc">订单状态</div>
                            </th>
                            <th abbr="article_time" axis="col6" class="w100">
                                <div class="tc">操作描述</div>
                            </th>
                            <th abbr="article_title" axis="col3" class="">
                                <div style="text-align: left; padding-left: 10px;" class="">操作备注</div>
                            </th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="bDiv" style="height: auto;">
                <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
                    <table style="width: 100%;">
                        <tbody>
                        {empty name="Action"}
                            <tr>
                                <td class="no-data" align="center" axis="col0" colspan="50">
                                    <i class="fa fa-exclamation-circle"></i>没有符合条件的记录
                                </td>
                            </tr>
                        {else/}
                            {foreach name="Action" item="vo" key="k" }
                            <tr>
                                <td class="sort">
                                    <div class="tl w10"></div>
                                </td>
                                <td class="sort">
                                    <div class="tl w130">
                                        {$vo.username}
                                    </div>
                                </td>
                                <td class="sort">
                                    <div class="tc w180">
                                        {$vo.add_time|MyDate='Y-m-d H:i:s',###}
                                    </div>
                                </td>
                                <td class="sort">
                                    <div class="tc w100">
                                        {$admin_order_status_arr[$vo.order_status]|default=''}
                                    </div>
                                </td>
                                <td class="sort">
                                    <div class="tc w100">
                                        {$vo.pay_status}
                                    </div>
                                </td>
                                <td class="sort">
                                    <div class="tc w100">
                                        {$vo.express_status}
                                    </div>
                                </td>
                                <td class="sort">
                                    <div class="tc w100">
                                        {$vo.action_desc}
                                    </div>
                                </td>
                                <td class="" style="width: 100%;">
                                    <div class="tl" style="padding-left: 10px;">
                                        {$vo.action_note}
                                    </div>
                                </td>
                            </tr>
                            {/foreach}
                        {/empty}
                        </tbody>
                    </table>
                </div>
                <div class="iDiv" style="display: none;"></div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    // 判断输入框是否为空
    function OrderMark(status_name){
        if('qfh' == status_name){
            var order_id = '{$OrderData.order_id}';
            var url = "{:url('Shop/order_send')}";
            if (url.indexOf('?') > -1) {
                url += '&';
            } else {
                url += '?';
            }
            url += 'order_id='+order_id;
            window.location.href = url;
            return false;
        }else if('yfk' == status_name){
            var msg = '确认订单已付款？';
        }else if('ysh' == status_name){
            var msg = '确认订单已收货？';
        }else if('wfk' == status_name){
            var msg = '确认订单未付款？';
        }else if('wx' == status_name){
            var msg = '确认订单无效？';
        }
        
        layer.confirm(msg, {
            title: false,
            btn: ['确定','取消']
        },function(){
            $('#status_name').val(status_name);
            layer_loading('正在处理');
            $('#postForm').submit();
        },function(index){
            layer.closeAll(index);
        });
    }

    // 更新管理员备注
    function UpNote(order_id){
        var admin_note = $('#admin_note').val();
        $.ajax({
            url: "{:url('Shop/update_note', ['_ajax'=>1])}",
            data: {order_id:order_id,admin_note:admin_note},
            type:'post',
            dataType:'json',
            success:function(res){
                layer.closeAll();
                if ('1' == res.code) {
                    layer.msg(res.msg, {time: 1500});
                }else{
                    layer.msg(res.msg, {time: 1500});
                }
            }
        });
    }

    $(document).ready(function(){
        // 表格行点击选中切换
        $('#flexigrid > table>tbody >tr').click(function(){
            $(this).toggleClass('trSelected');
        });

        // 点击刷新数据
        $('.fa-refresh').click(function(){
            location.href = location.href;
        });
    });
</script>
{include file="public/footer" /}